<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./hj.css">
</head>

<body>
    <!--对象语法-->
    <div id="app">
        <div :class="{'active': isActive}"></div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                isActive: true
            }
        })
    </script>

    <div id="app">
        <div class="static" :class="{'active': isActive, 'error':isError}"></div>
    </div>

    <script>
        var app = new Vue({
            el: '#app',
            data: {
                isActive: true,
                isError: false
            }
        })
    </script>

    <div id="app">
        <div:class="classes">
    </div>
    </div>

    <Script>
        var app = new Vue({
            el: '#app',
            data: {
                isActive: true,
                error: null


            },

            computed: {
                classes: function () {
                    return {
                        active: this.isActive && !this.error,
                        'text-fail': this.error && this.error.type === 'fail'
                    }
                }
            }
        })
    </Script>
</body>

</html>